//
//  MWBannerCell.m
//  XiRan-iOS
//
//  Created by Richfit on 2019/10/11.
//  Copyright © 2019 Wood. All rights reserved.
//

#import "MWBannerCell.h"

@interface MWBannerCell () <SDCycleScrollViewDelegate>

@property(nonatomic, strong) SDCycleScrollView *bannerView;

@end

@implementation MWBannerCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        _bannerView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, kScreenWidth - 32, 150) delegate:self placeholderImage:[UIImage imageNamed:@"lunbo"]];
        _bannerView.backgroundColor = [UIColor whiteColor];
        _bannerView.layer.cornerRadius = 5;
        _bannerView.layer.masksToBounds = YES;
        [self addSubview:_bannerView];
    }
    return self;
}

- (void)configUrlArray:(NSArray *)urlArray {
    NSMutableArray *tempArray = [[NSMutableArray alloc] init];
    for (NSString *str in urlArray) {
        NSString *tempUrl = [NSString stringWithFormat:@"%@?x-oss-process=image/resize,h_450", str];
        NSString *url = [tempUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:tempUrl]];
        [tempArray addObject:url];
    }
    
    _bannerView.imageURLStringsGroup = tempArray;
}

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
    
}

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {
    
}
    
@end
